<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="com.model.Resource" %>
<%@ page import="com.control.ResourceControl" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<% 
	request.setCharacterEncoding("UTF-8"); 
	String name = request.getParameter("name"); 
	int num = Integer.parseInt(request.getParameter("number")); 
	String des = request.getParameter("describe"); 
	Resource resource = new Resource(); 
	ResourceControl rc = new ResourceControl();
	resource.setRes_name(name);
	resource.setRes_num(num);
	resource.setRes_des(des);
	if(rc.insertResource(resource)){
%>
	<script>
		if(window.confirm("添加物品成功,是否继续增加！"))
		window.location.href="add_resource.jsp";
	else
		window.location.href="resource_show.jsp"
	</script>
<%}
	else{ %>
	<script>
		alert("添加失败！");
		window.location.href="add_resource.jsp"
	</script>
<%} %>
	
</body>
</html>